#include "additem.h"
#include "ui_additem.h"
#include <QDebug>

addItem::addItem(QString& flag,QWidget *parent) :
    QWidget(parent),
    m_isFriend(flag),
    ui(new Ui::addItem)
{
    ui->setupUi(this);
    if(m_isFriend == "1")
    {

        ui->addBtn->hide();
    }
    connect(ui->addBtn,&QPushButton::clicked,this,&addItem::handleAdd);
}

addItem::~addItem()
{
    delete ui;
}

void addItem::setPix(const QPixmap &pic)
{
    ui->headPhoto->setPixmap(pic);
}

void addItem::setAccount(const QString &account)
{
    ui->account->setText(account);
}

void addItem::setNote(const QString &note)
{
    ui->note->setText(note);
}

void addItem::setAttr(int flag)
{
    m_attr = flag;
}

QString addItem::getAccount()
{
    return ui->account->text();
}

int addItem::getAttr()
{
    return m_attr;
}

QString addItem::getIsFriend()
{
    return m_isFriend;
}


void addItem::handleAdd()
{
    emit addSignal(ui->account->text(),ui->note->text());
}
